Skip to content

Conversation

@xsscx
Copy link
Member

@xsscx xsscx commented Jan 10, 2026

Pull Request Checklist

  • Have you followed the guidelines in Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you built your Pull Request locally with the Build Instructions?
  • Have you added or updated relevant tests?
  • Have you added or updated relevant docs?

@xsscx xsscx self-assigned this Jan 10, 2026
Copilot AI review requested due to automatic review settings January 10, 2026 01:00
@xsscx xsscx added the PR Pull Request label Jan 10, 2026
@xsscx xsscx requested a review from ChrisCoxArt as a code owner January 10, 2026 01:00
@xsscx xsscx added Configuration Configuration Issues Build Build Issues Merge Ready Maintainer indicates Merge Ready labels Jan 10, 2026
@xsscx xsscx linked an issue Jan 10, 2026 that may be closed by this pull request
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request modernizes the RefIccMAX CMake configuration file by transforming it from a basic find module into a comprehensive CMake package configuration file. The changes enable better integration with modern CMake projects and vcpkg package management.

Key changes:

  • Introduces modern IMPORTED targets (IccProfLib2, IccXML2, and their static variants) following current CMake best practices
  • Adds comprehensive documentation and usage examples for both modern targets and legacy variables
  • Implements proper library detection for both shared and static library variants, including debug builds
  • Maintains full backward compatibility with existing projects using legacy variables (REFICCMAX_LIBRARIES, REFICCMAX_INCLUDE_DIRS)

Comment on lines +161 to +167
IMPORTED_LOCATION_DEBUG "${ICCXML2_LIBRARY_DEBUG}"
)
endif()
if(TARGET IccProfLib2)
set_target_properties(IccXML2 PROPERTIES
INTERFACE_LINK_LIBRARIES IccProfLib2
)
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IccXML2 library's INTERFACE_LINK_LIBRARIES is set to IccProfLib2 (line 166), but there's no check whether IccProfLib2 was found as a shared or static library. If IccProfLib2 is static and IccXML2 is shared, this could cause linking issues. Consider linking to the appropriate variant (IccProfLib2-static if IccXML2 is static, IccProfLib2 if shared) based on which library type was found.

Suggested change
IMPORTED_LOCATION_DEBUG "${ICCXML2_LIBRARY_DEBUG}"
)
endif()
if(TARGET IccProfLib2)
set_target_properties(IccXML2 PROPERTIES
INTERFACE_LINK_LIBRARIES IccProfLib2
)
IMPORTED_LOCATION_DEBUG "${ICC2XML_LIBRARY_DEBUG}"
)
endif()
if(TARGET IccProfLib2)
# Prefer linking against shared IccProfLib2 when available
set_target_properties(IccXML2 PROPERTIES
INTERFACE_LINK_LIBRARIES IccProfLib2
)
elseif(TARGET IccProfLib2-static)
# Fallback: link against static IccProfLib2-static if only static is available
set_target_properties(IccXML2 PROPERTIES
INTERFACE_LINK_LIBRARIES IccProfLib2-static
)

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential True Positive. Testing in Progress.


# IccProfLib2 shared library
if(ICCPROFLIB2_LIBRARY AND NOT TARGET IccProfLib2)
add_library(IccProfLib2 SHARED IMPORTED)
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ICCPROFLIB2_LIBRARY is marked as SHARED IMPORTED (line 125), but there's no verification that the library is actually shared. The find_library command finds any library with the given name regardless of type. If a static library is found instead, this will cause a mismatch. Consider using UNKNOWN IMPORTED instead of SHARED IMPORTED and setting the IMPORTED_LINK_INTERFACE_LIBRARIES property appropriately, or verify the library type before creating the target.

Suggested change
add_library(IccProfLib2 SHARED IMPORTED)
add_library(IccProfLib2 UNKNOWN IMPORTED)

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential True Positive. Testing in Progress.


# IccXML2 shared library
if(ICCXML2_LIBRARY AND NOT TARGET IccXML2)
add_library(IccXML2 SHARED IMPORTED)
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IccXML2 library is marked as SHARED IMPORTED (line 154), but there's no verification that the library is actually shared. The find_library command finds any library with the given name regardless of type. If a static library is found instead, this will cause a mismatch. Consider using UNKNOWN IMPORTED instead of SHARED IMPORTED, or verify the library type before creating the target.

Suggested change
add_library(IccXML2 SHARED IMPORTED)
add_library(IccXML2 UNKNOWN IMPORTED)

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential True Positive. Testing in Progress.

Comment on lines +53 to +56
# Fallback for system-wide installation
find_path(REFICCMAX_INCLUDE_DIR
NAMES @TARGET_LIB_ICCPROFLIB@/IccProfLibVer.h
PATHS @CMAKE_INSTALL_FULL_INCLUDEDIR@/@TARGET_INCLUDE_FOLDER@
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback find_path for REFICCMAX_INCLUDE_DIR (lines 54-57) will search system-wide paths, but it may find an incompatible version if RefIccMAX is installed system-wide. This could cause version mismatches. Consider adding a VERSION check or making the NO_DEFAULT_PATH behavior stricter to avoid mixing installation locations.

Suggested change
# Fallback for system-wide installation
find_path(REFICCMAX_INCLUDE_DIR
NAMES @TARGET_LIB_ICCPROFLIB@/IccProfLibVer.h
PATHS @CMAKE_INSTALL_FULL_INCLUDEDIR@/@TARGET_INCLUDE_FOLDER@
# Fallback for system-wide installation (restricted to explicit paths)
find_path(REFICCMAX_INCLUDE_DIR
NAMES @TARGET_LIB_ICCPROFLIB@/IccProfLibVer.h
PATHS @CMAKE_INSTALL_FULL_INCLUDEDIR@/@TARGET_INCLUDE_FOLDER@
NO_DEFAULT_PATH

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential True Positive. Testing in Progress.

find_package_handle_standard_args(RefIccMAX
REQUIRED_VARS REFICCMAX_INCLUDE_DIR
VERSION_VAR REFICCMAX_VERSION
HANDLE_COMPONENTS
Copy link

Copilot AI Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HANDLE_COMPONENTS option is specified in find_package_handle_standard_args (line 106), but there's no code to actually handle components. This will cause CMake to fail if users specify components like find_package(RefIccMAX COMPONENTS IccProfLib2). Either remove HANDLE_COMPONENTS or implement proper component handling by checking RefIccMAX_FIND_COMPONENTS and setting component-specific FOUND variables.

Suggested change
HANDLE_COMPONENTS

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential True Positive. Testing in Progress.

@xsscx xsscx force-pushed the cmake-add-targets branch from 23e5549 to 42afd45 Compare January 10, 2026 01:39
@xsscx xsscx added vcpkg vcpkg issues PM Package Manager labels Jan 10, 2026
@xsscx xsscx linked an issue Jan 10, 2026 that may be closed by this pull request
@xsscx xsscx changed the title Update RefIccMAX CMake configuration file vcpkg install iccdev Jan 10, 2026
@xsscx xsscx linked an issue Jan 10, 2026 that may be closed by this pull request
@xsscx xsscx requested a review from Copilot January 10, 2026 01:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

@xsscx xsscx added Review in Process PR being Reviewed by Maintainers Test Status Maintainer indicates TEST Status and removed Merge Ready Maintainer indicates Merge Ready labels Jan 10, 2026
@xsscx
Copy link
Member Author

xsscx commented Jan 10, 2026

Status

Modify Private static to Static but the scope is TBD.

│ 301      * Function: GetInstance() │
│ 306  -   * Private static function foo │
│ 302  +   * Static function foo

and.... Class Mods...

97     * Purpose: The Reflectance Observer Element │
│ 398     ***************************************************************************** │
│ 399     */ │
│ 400  -  class CIccMpeReflectanceObserver : public CIccMpeSpectralObserver │
│ 400  +  class ICCPROFLIB_API CIccMpeReflectanceObserver : public CIccMpeSpectralObserver │

@xsscx
Copy link
Member Author

xsscx commented Jan 10, 2026

Status

Considering the issues present, the Libs install across all platforms as expected. The Tools are not ready.

vcpkg install iccdev will correctly install IccProfLib & IccXMLLib
vcpkg install iccdev[tools] is not ready due to Source Code needing Modification as indicated above.

@xsscx
Copy link
Member Author

xsscx commented Jan 10, 2026

vcpkg compile errors

Sample

iccDumpProfile.cpp.obj : error LNK2001: unresolved external symbol "char const * const icMsgValidateWarning" (?icMsgValidateWarning@@3PEBDEB)
iccDumpProfile.cpp.obj : error LNK2001: unresolved external symbol "char const * const icMsgValidateNonCompliant" (?icMsgValidateNonCompliant@@3PEBDEB)
Tools\IccDumpProfile\iccDumpProfile.exe : fatal error LNK1120: 2 unresolved externals

@xsscx
Copy link
Member Author

xsscx commented Jan 14, 2026

Status

Wed Jan 14 01:09:23 AM UTC 2026

Commit Info

git rev-parse HEAD && git show --no-patch --oneline

5c02515
5c02515 (HEAD -> pr-473, origin/cmake-add-targets) TEST Windows Only CMake Target

Windows Reproduction

git clone https://github.com/InternationalColorConsortium/iccDEV.git
cd iccDEV
git fetch origin pull/473/head:pr-473
git checkout pr-473

Windows vcpkg install[core,tools]

PS C:\testing\iccDEV> ..\vcpkg\vcpkg.exe --classic install 'iccdev[core,tools]' --overlay-ports=vcpkg-port --recurse --no-binarycaching
warning: The vcpkg C:\testing\vcpkg\vcpkg.exe is using detected vcpkg root C:\testing\vcpkg and ignoring mismatched VCPKG_ROOT environment value C:\Program Files\Microsoft Visual Studio\2022\Community\VC\vcpkg. To suppress this message, unset the environment variable or use the --vcpkg-root command line switch.
Computing installation plan...
The following packages are already installed:
    iccdev[core,tools]:[email protected]
Total install time: 998 us
iccdev provides ICC color profile libraries and tools.

Platform Support: Windows only (Linux/macOS support under development)

The package provides the following libraries:
  - IccProfLib2: Core ICC profile library
  - IccXML2: XML serialization/deserialization for ICC profiles

Usage with CMake:
  find_package(RefIccMAX CONFIG REQUIRED)
  target_link_libraries(main PRIVATE IccProfLib2 IccXML2)

Command-line tools (if built with 'tools' feature):
  - IccFromXml: Create ICC profiles from XML
  - IccToXml: Convert ICC profiles to XML
  - IccDumpProfile: Display profile information
  - IccApplyToLink: Apply ICC profiles to images
  - IccTiffDump: Extract ICC profiles from TIFF files
  - And more in ${VCPKG_INSTALLED_DIR}/tools/iccdev/

Documentation: https://github.com/InternationalColorConsortium/iccdev

All requested installations completed successfully in: 998 us

Unix Reproduction

git clone https://github.com/InternationalColorConsortium/iccDEV.git
cd iccDEV
git fetch origin pull/473/head:pr-473
git checkout pr-473

Unix vcpkg install

~/vcpkg/vcpkg --classic install 'iccdev[core,tools]' --overlay-ports=vcpkg-port --recurse

Expected Output

Computing installation plan...
iccdev is only supported on 'windows & !(uwp | arm)', which does not match x64-linux. This usually means that there are known build failures, or runtime problems, when building other platforms. To ignore this and attempt to build iccdev anyway, rerun vcpkg with `--allow-unsupported`.

@xsscx
Copy link
Member Author

xsscx commented Jan 14, 2026

PR Author Comment

vcpkg install across Windows, Linux & macOS is not 100% installable for core & tools due to vcpkg dependency issues.

Path of least resistance is to move forward with VCPKG PR for Windows-only Cmake Target.

@xsscx xsscx added Merge Ready Maintainer indicates Merge Ready and removed Review in Process PR being Reviewed by Maintainers Configuration Configuration Issues Build Build Issues Test Status Maintainer indicates TEST Status labels Jan 14, 2026
@xsscx xsscx removed a link to an issue Jan 14, 2026
@xsscx xsscx added Pending Merge Maintainer indicates Merge Pending and requests no further changes and removed Merge Ready Maintainer indicates Merge Ready labels Jan 14, 2026
@xsscx
Copy link
Member Author

xsscx commented Jan 14, 2026

Status

Wed Jan 14 02:57:36 AM UTC 2026

For 'vcpkg install iccdev' the Law of Diminishing Returns has been met.

The Cmake alignment will be Committed, the vcpkg configurations withdrawn.

vcpkg is a nice to have thing, but not necessary and is a Time Sink!

@xsscx xsscx force-pushed the cmake-add-targets branch from 5c02515 to b494bff Compare January 14, 2026 03:07
@xsscx xsscx changed the title vcpkg install iccdev Update RefIccMAX CMake configuration file Jan 14, 2026
@xsscx xsscx requested a review from Copilot January 14, 2026 03:09
Update RefIccMAX CMake configuration file
@xsscx xsscx force-pushed the cmake-add-targets branch from b494bff to 5be4e0d Compare January 14, 2026 03:11
@xsscx xsscx merged commit 0dbe22e into master Jan 14, 2026
13 checks passed
@xsscx xsscx added Merged Merged Configuration Configuration Issues and removed Pending Merge Maintainer indicates Merge Pending and requests no further changes vcpkg vcpkg issues PM Package Manager labels Jan 14, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

Comment on lines +164 to +168
if(TARGET IccProfLib2)
set_target_properties(IccXML2 PROPERTIES
INTERFACE_LINK_LIBRARIES IccProfLib2
)
endif()
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The INTERFACE_LINK_LIBRARIES is only set if the IccProfLib2 target exists, but IccXML2 likely depends on IccProfLib2 in all cases. If IccProfLib2 doesn't exist but IccProfLib2-static does (and was aliased to IccProfLib2), this dependency won't be properly set. Consider checking for either IccProfLib2 or IccProfLib2-static, or rely on the alias being created.

Copilot uses AI. Check for mistakes.
Comment on lines +82 to +95
NAMES IccXML2
HINTS "${REFICCMAX_PREFIX}/lib"
PATHS @CMAKE_INSTALL_FULL_LIBDIR@
NO_DEFAULT_PATH
)
MARK_AS_ADVANCED(REFICCMAX_INCLUDE_DIR)

find_library(ICCXML2_LIBRARY_DEBUG
NAMES IccXML2d
HINTS "${REFICCMAX_PREFIX}/debug/lib"
NO_DEFAULT_PATH
)

# Set path to the library.
FIND_LIBRARY( REFICCMAX_LIBRARIES
NAMES @TARGET_LIB_ICCPROFLIB@
PATHS @CMAKE_INSTALL_FULL_LIBDIR@/
find_library(ICCXML2_STATIC_LIBRARY
NAMES IccXML2-static
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The library name "IccXML2" is hardcoded on lines 82, 89, and 95, while the IccProfLib2 searches use the configurable @TARGET_LIB_ICCPROFLIB@ variable (line 62, 69, 75). For consistency and maintainability, consider using a @TARGET_LIB_ICCXML@ variable instead of hardcoding the library name.

Copilot uses AI. Check for mistakes.
Comment on lines +191 to 199
# Legacy support - set REFICCMAX_LIBRARIES if not already set
if(NOT REFICCMAX_LIBRARIES)
if(ICCPROFLIB2_LIBRARY)
list(APPEND REFICCMAX_LIBRARIES "${ICCPROFLIB2_LIBRARY}")
elseif(ICCPROFLIB2_STATIC_LIBRARY)
list(APPEND REFICCMAX_LIBRARIES "${ICCPROFLIB2_STATIC_LIBRARY}")
endif()
endif()

Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's an inconsistency in REFICCMAX_LIBRARIES values. Earlier sections (lines 135, 148, 169, 187) append CMake target names (e.g., IccProfLib2, IccXML2), while the legacy support section appends raw library paths (ICCPROFLIB2_LIBRARY, ICCPROFLIB2_STATIC_LIBRARY). This mixing of target names and paths in the same variable will confuse consumers. The legacy section should either be removed (since targets are set above) or the logic should be restructured to use only paths for legacy support.

Suggested change
# Legacy support - set REFICCMAX_LIBRARIES if not already set
if(NOT REFICCMAX_LIBRARIES)
if(ICCPROFLIB2_LIBRARY)
list(APPEND REFICCMAX_LIBRARIES "${ICCPROFLIB2_LIBRARY}")
elseif(ICCPROFLIB2_STATIC_LIBRARY)
list(APPEND REFICCMAX_LIBRARIES "${ICCPROFLIB2_STATIC_LIBRARY}")
endif()
endif()

Copilot uses AI. Check for mistakes.
Comment on lines +81 to 99
find_library(ICCXML2_LIBRARY
NAMES IccXML2
HINTS "${REFICCMAX_PREFIX}/lib"
PATHS @CMAKE_INSTALL_FULL_LIBDIR@
NO_DEFAULT_PATH
)
MARK_AS_ADVANCED(REFICCMAX_INCLUDE_DIR)

find_library(ICCXML2_LIBRARY_DEBUG
NAMES IccXML2d
HINTS "${REFICCMAX_PREFIX}/debug/lib"
NO_DEFAULT_PATH
)

# Set path to the library.
FIND_LIBRARY( REFICCMAX_LIBRARIES
NAMES @TARGET_LIB_ICCPROFLIB@
PATHS @CMAKE_INSTALL_FULL_LIBDIR@/
find_library(ICCXML2_STATIC_LIBRARY
NAMES IccXML2-static
HINTS "${REFICCMAX_PREFIX}/lib"
PATHS @CMAKE_INSTALL_FULL_LIBDIR@
NO_DEFAULT_PATH
)
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IccXML2 library searches (lines 81-99) are missing the PATHS argument with CMAKE_INSTALL_FULL_LIBDIR that the IccProfLib2 searches have (lines 64, 77). This inconsistency means IccXML2 libraries won't be found if the package is installed in a system-wide location but the REFICCMAX_PREFIX calculation doesn't work. Add the PATHS argument for consistency and robustness.

Copilot uses AI. Check for mistakes.
set(REFICCMAX_INCLUDE_DIRS "${REFICCMAX_INCLUDE_DIR}")

# Set up include directories for all subdirectories
# IccXML2 headers need access to IccProfLib2 headers via relative includes
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment states "IccXML2 headers need access to IccProfLib2 headers via relative includes" but the actual includes in IccXML files use direct includes like #include "IccProfile.h" without relative paths. The comment should be updated to accurately reflect that IccXML2 headers include IccProfLib2 headers directly, requiring both directories to be in the include path.

Suggested change
# IccXML2 headers need access to IccProfLib2 headers via relative includes
# IccXML2 headers directly include IccProfLib2 headers, so both dirs must be in the include path

Copilot uses AI. Check for mistakes.

# IccProfLib2 shared library
if(ICCPROFLIB2_LIBRARY AND NOT TARGET IccProfLib2)
add_library(IccProfLib2 SHARED IMPORTED)
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The library type is hardcoded as SHARED, but the actual library type should be determined from the library file extension or build configuration. If only static libraries were built, this will create an incorrectly typed IMPORTED target. Consider using UNKNOWN library type or checking the actual library type.

Suggested change
add_library(IccProfLib2 SHARED IMPORTED)
add_library(IccProfLib2 UNKNOWN IMPORTED)

Copilot uses AI. Check for mistakes.
find_package_handle_standard_args(RefIccMAX
REQUIRED_VARS REFICCMAX_INCLUDE_DIR
VERSION_VAR REFICCMAX_VERSION
HANDLE_COMPONENTS
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HANDLE_COMPONENTS flag is specified but no components are actually defined or validated. Either remove the HANDLE_COMPONENTS flag if components are not needed, or implement proper component handling by checking for requested components (e.g., IccProfLib2, IccXML2) in the find_package call.

Suggested change
HANDLE_COMPONENTS

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Configuration Configuration Issues Merged Merged PR Pull Request

Projects

None yet

3 participants